using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace eBenefits.Web
{
	/// <summary>
	/// User account controller.
	/// </summary>
	public class UserAccountController : eBenefits.Web.Framework.eBenefitsWebController
	{
		//
		// GET: /UserAccount/

		public ActionResult Index ()
		{
			return View ("Index", this.SiteMaster);
		}

		//
		// GET: /Register/Details/5

		public ActionResult Details (int id)
		{
			return View ();
		}

		//
		// GET: /UserAccount/Create

		public ActionResult Create ()
		{
		
			eBenefits.Web.Models.UserAccount userAccount = new eBenefits.Web.Models.UserAccount();
			userAccount.Email = "someone@somewhere.com";
			userAccount.Username = "zhixian";
			userAccount.Password = "pass1";
			userAccount.ConfirmedPassword = "pass2";
			return View ("Create", this.SiteMaster, userAccount);
		} 

		//
		// POST: /Register/Create

		[AcceptVerbs(HttpVerbs.Post)]
		public ActionResult Create (FormCollection collection)
		{
			try {
				// TODO: Add insert logic here
				this.DebugLog("In public ActionResult Create (FormCollection collection)");
				foreach (string key in collection.AllKeys)
				{
					this.DebugLog (string.Format("Received>> key: {0}, value: {1}", 
						key, collection[key]));
				}
								
				return RedirectToAction ("Index");
			} catch {
				return View ();
			}
		}
        
		//
		// GET: /Register/Edit/5
 
		public ActionResult Edit (int id)
		{
			return View ();
		}

		//
		// POST: /Register/Edit/5

		[AcceptVerbs(HttpVerbs.Post)]
		public ActionResult Edit (int id, FormCollection collection)
		{
			try {
				// TODO: Add update logic here
 
				return RedirectToAction ("Index");
			} catch {
				return View ();
			}
		}

		//
		// GET: /Register/Delete/5
 
		public ActionResult Delete (int id)
		{
			return View ();
		}

		//
		// POST: /Register/Delete/5

		[AcceptVerbs(HttpVerbs.Post)]
		public ActionResult Delete (int id, FormCollection collection)
		{
			try {
				// TODO: Add delete logic here
 
				return RedirectToAction ("Index");
			} catch {
				return View ();
			}
		}

	}
}

